package com.shiwenping.reply.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.alibaba.android.vlayout.layout.LinearLayoutHelper;

/**
 *
 * @author haichecker
 * @date 17-11-8
 */

public abstract class AbstractListAdapter<VH extends RecyclerView.ViewHolder> extends DelegateAdapter.Adapter<VH> {
    //行高
    private int dividerHeight;
    //上下文
    protected Context context;
    //背景颜色
    private int bgColor;
    //inflater
    protected LayoutInflater inflater;

    public AbstractListAdapter(int dividerHeight, Context context, int bgColor) {
        this.dividerHeight = dividerHeight;
        this.context = context;
        this.bgColor = bgColor;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        LinearLayoutHelper linearLayoutHelper = new LinearLayoutHelper(dividerHeight);
        linearLayoutHelper.setBgColor(bgColor);
        return linearLayoutHelper;
    }

}
